package com.wavehi.web.homework.sixth;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

/**
 * @Author WaveHi
 * @Date 17/9/2021 下午 9:37
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description
 */
@WebServlet("/jstlDemoServlet")
public class JSTLDemoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置域对象的数据
        req.setAttribute("num1", 12);
        req.setAttribute("num2", 23);
        req.setAttribute("date", new Date());
        //获取请求转发对象
        RequestDispatcher dis = req.getRequestDispatcher("page/homework/homework06.jsp");
        //转发
        dis.forward(req, resp);
    }
}
